#include<stdio.h> 
#include<stdlib.h>
#include<time.h>
int main()
{
	int x,num,i;
	printf("猜一个1-100之间数\n");
	do
	{
		srand((unsigned)time(NULL));
		x=(rand()%100);
	}while(x<0||x>100);
	for(i=0;i<10;i++)
	{
		do
		{
			printf("num%d=",i+1);
			scanf("%d",&num);
		}while(num<0||num>100);
		if(num==x)
		{
			printf("正确\n");
			printf("猜了%d次数\n",i+1);
			break;
		}
		if(num>x)printf("猜大了\n");
		if(num<x)printf("猜小了\n");
	}
	return 0;
}